package xing.design.pattern.behavioral.Memento.sample3_andCommandPattern.editor.command.edit;

import xing.design.pattern.behavioral.Memento.sample3_andCommandPattern.editor.Editor;

/**
 * @author xing
 * @date 2023/2/10 14:58:50
 */
public class PasteCommand extends EditCommand {
    private String pasteContent;

    public PasteCommand(String pasteContent) {
        this.pasteContent = pasteContent;
    }

    @Override
    protected void doExecute(Editor editor) {
        String content = editor.getContent();
        editor.setContent(content + pasteContent);
    }

    @Override
    public String getName() {
        return "paste";
    }
}
